/**
 * Created by limei on 2018/5/10.
 */
import MYCONF from '../myconf'
export default {
  state: {
    hotMap_time: {},     //全部车辆当前选择时间
    single_time: {},     //单车当前选择时间
    single_car: {
      // id:'甘H81031'
    },
    company_info: {
      id:'123',
      name:"某旅游公司"
    },
    loading_state: false,    //加载动画
    axis_num: {
      hour: 0,
      index: 0
    },    //历史播放的当前小时和序号
    speed:MYCONF.HISTORY_SPEED,
    isMapDraged:false,   //历史播放时，地图是否已拖拽
    carType:MYCONF.CAR_TYPE,    //0-全部，1-出租车，2-公交车，3-班线客车，4-旅游包车，5-危险货车，6-普通货车
    alarmInfo:{},   //报警信息
    single_map_state:{
      center:MYCONF.map.center,
      zoom:MYCONF.map.zoom,
    },
    style: MYCONF.maps.initStyle,
    isMainPopShow:false,
    isNavShow : false,
  },

  getters: {
    hotMap_time: state => state.hotMap_time,
    single_time: state => state.single_time,
    single_car: state => state.single_car,
    company_info: state => state.company_info,
    loading_state: state => state.loading_state,
    axis_num: state => state.axis_num,
    speed: state => state.speed,
    isMapDraged: state => state.isMapDraged,
    carType: state => state.carType,
    alarmInfo: state => state.alarmInfo,
    single_map_state: state => state.single_map_state,
    style: state => state.style,
    isMainPopShow : state => state.isMainPopShow,
    isNavShow : state => state.isNavShow,
  },

  mutations: {
    updateHotMapTime(state, payload) {
      state.hotMap_time = Object.assign({}, state.hotMap_time, payload);
    },
    updateSingleTime(state, payload) {
      state.single_time = Object.assign({}, state.single_time, payload);
    },
    updateSingleCar(state, payload) {
      state.single_car = Object.assign({}, state.single_car, payload);
    },
    updateCompanyInfo(state, payload) {
      state.company_info = Object.assign({}, state.company_info, payload);
    },
    updateLoadingState(state, payload) {
      state.loading_state = payload;
    },
    updateAxisNum(state, payload) {
      state.axis_num = Object.assign({}, state.axis_num, payload);
    },
    updateHistorySpeed(state, payload) {
      state.speed = payload;
    },
    updateMapDraged(state, payload) {
      state.isMapDraged = payload;
    },
    updateCarType(state, payload) {
      state.carType = payload;
    },
    updateAlarmInfo(state, payload) {
      state.alarmInfo = payload;
    },
    updateSingleMapState(state, payload) {
      state.single_map_state = Object.assign({}, state.single_map_state, payload);
    },
    updateStyle(state, payload) {
      state.style = payload;
    },
    updateIsMainPopShow(state, payload){
      state.isMainPopShow = payload;
    },
    updateIsNavShow(state, payload){
      state.isNavShow = payload;
    }
  },

}
